package com.joney.website.entity.enums;

import com.baomidou.mybatisplus.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonValue;

import java.io.Serializable;

/**
 * 消费种类 类别 1:早餐 2:午餐 3:晚餐 4:零食 5:日常生活用品 6:鲜花/礼品 7:服饰 8:房租水电 9:电话费 10:车费 11:游玩/娱乐 12:车辆油费/耗损 13:化妆品 14:家电耗材 15:其它
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ConsumeKindsEnum implements IEnum {


    ONE(1, "早餐"),
    TWO(2, "午餐"),
    THREE(3, "晚餐"),
    FOUR(4, "零食"),
    FIVE(5, "生活用品"),
    SIX(6, "鲜花/礼品"),
    SEVEN(7, "服饰"),
    EIGHT(8, "房租水电"),
    NINE(9, "电话费"),
    TEN(10, "车费"),
    ELEVEN(11, "游玩/娱乐"),
    TWELVE(12, "车辆油费/耗损"),
    THIRTEEN(13, "化妆品"),
    FOURTEEN(14, "家电耗材"),
    FIFTEEN(15, "其它");

    private int code;
    private String desc;

    ConsumeKindsEnum(final int code, final String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public Serializable getValue() {
        return this.code;
    }

    public int code() {
        return this.code;
    }

    @JsonValue
    public String getDesc(){
        return this.desc;
    }



    public static ConsumeKindsEnum getKindsEnumByCode(int code){
        for(ConsumeKindsEnum kindsEnum : ConsumeKindsEnum.values()){
            if(kindsEnum.code==code){
                return kindsEnum;
            }
        }
        return null;
    }



}
